package logic

import (
	"context"
	"manage/models/mysql"

	"manage/managerpc/internal/svc"
	"manage/managerpc/managerpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ActivityAddLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewActivityAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ActivityAddLogic {
	return &ActivityAddLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 活动发布
func (l *ActivityAddLogic) ActivityAdd(in *managerpc.ActivityAddRequest) (*managerpc.ActivityAddResponse, error) {
	// todo: add your logic here and delete this line
	user := mysql.Activity{
		UserId: int(in.UserId),
		Title:  in.Title,
		Image:  in.Image,
		Static: in.Static,
	}
	mysql.DB.Create(&user)
	return &managerpc.ActivityAddResponse{
		Id: in.Id,
	}, nil
}
